import random
num = random.randint(1,100)

flag = True
count = 0
while flag:
    guess_num = int(input("请输入你猜测的数字："))
    count += 1
    if guess_num == num:
        print("猜对了。")
        flag = False
    else:
        if guess_num > num:
            print("大了。")
        elif guess_num < num:
            print("小了。")
print(f"你总共猜了{count}次了。")


